package org.easymis.oa.modules.main.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.easymis.entitys.mybatis.dto.OrganizeFunction;
import org.easymis.oa.service.datacenter.OrganizeFunctionMng;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/workflow/")
public class WorkFlowAction {
	@Autowired
	OrganizeFunctionMng organizeFunctionMng;
	@RequestMapping(value = "todo")
	public String forwardTodo(HttpServletRequest request, HttpSession session,ModelMap model) throws Exception {
		String functionId=request.getParameter("menuId");
		List<OrganizeFunction> breadcrumbList= organizeFunctionMng.getBreadcrumb(functionId);
		request.setAttribute("base", "http://demo.easymis.cn/oa");
		model.put("breadcrumbList", breadcrumbList);
		return "/workflow/todo";
	}
	@RequestMapping(value = "finshed")
	public String forwardFinshed(HttpServletRequest request, HttpSession session,ModelMap model) throws Exception {
		String functionId=request.getParameter("menuId");
		List<OrganizeFunction> breadcrumbList= organizeFunctionMng.getBreadcrumb(functionId);
		request.setAttribute("base", "http://demo.easymis.cn/oa");
		model.put("breadcrumbList", breadcrumbList);
		return "/workflow/finshed";
	}
	@RequestMapping(value = "minecreate")
	public String forwardMinecreate(HttpServletRequest request, HttpSession session,ModelMap model) throws Exception {
		String functionId=request.getParameter("menuId");
		List<OrganizeFunction> breadcrumbList= organizeFunctionMng.getBreadcrumb(functionId);
		request.setAttribute("base", "http://demo.easymis.cn/oa");
		model.put("breadcrumbList", breadcrumbList);
		return "/workflow/minecreate";
	}
	@RequestMapping(value = "sharetome")
	public String forwardSharetome(HttpServletRequest request, HttpSession session,ModelMap model) throws Exception {
		String functionId=request.getParameter("menuId");
		List<OrganizeFunction> breadcrumbList= organizeFunctionMng.getBreadcrumb(functionId);
		request.setAttribute("base", "http://demo.easymis.cn/oa");
		model.put("breadcrumbList", breadcrumbList);
		return "/workflow/sharetome";
	}
	@RequestMapping(value = "watched")
	public String forwardWatched(HttpServletRequest request, HttpSession session,ModelMap model) throws Exception {
		String functionId=request.getParameter("menuId");
		List<OrganizeFunction> breadcrumbList= organizeFunctionMng.getBreadcrumb(functionId);
		request.setAttribute("base", "http://demo.easymis.cn/oa");
		model.put("breadcrumbList", breadcrumbList);
		return "/workflow/watched";
	}
	@RequestMapping(value = "all")
	public String forwardAll(HttpServletRequest request, HttpSession session,ModelMap model) throws Exception {
		String functionId=request.getParameter("menuId");
		List<OrganizeFunction> breadcrumbList= organizeFunctionMng.getBreadcrumb(functionId);
		request.setAttribute("base", "http://demo.easymis.cn/oa");
		model.put("breadcrumbList", breadcrumbList);
		return "/workflow/all";
	}


}
